.class public Ljavax/microedition/lcdui/Form;
.super Ljavax/microedition/lcdui/Screen;
.source "Form.java"


# instance fields
.field focusItemIndex:I

.field itemStateListener:Ljavax/microedition/lcdui/ItemStateListener;

.field items:[Ljavax/microedition/lcdui/Item;

.field numOfItems:I


# direct methods
.method public constructor <init>(Ljava/lang/String;)V
    .locals 1
    .parameter "title"

    .prologue
    .line 42
    invoke-direct {p0, p1}, Ljavax/microedition/lcdui/Screen;-><init>(Ljava/lang/String;)V

    .line 34
    const/4 v0, 0x4

    new-array v0, v0, [Ljavax/microedition/lcdui/Item;

    iput-object v0, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    .line 35
    const/4 v0, 0x0

    iput v0, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    .line 37
    const/4 v0, 0x0

    iput-object v0, p0, Ljavax/microedition/lcdui/Form;->itemStateListener:Ljavax/microedition/lcdui/ItemStateListener;

    .line 43
    invoke-static {}, Lorg/microemu/device/DeviceFactory;->getDevice()Lorg/microemu/device/Device;

    move-result-object v0

    invoke-interface {v0}, Lorg/microemu/device/Device;->getUIFactory()Lorg/microemu/device/ui/UIFactory;

    move-result-object v0

    invoke-interface {v0, p0}, Lorg/microemu/device/ui/UIFactory;->createFormUI(Ljavax/microedition/lcdui/Form;)Lorg/microemu/device/ui/FormUI;

    move-result-object v0

    invoke-super {p0, v0}, Ljavax/microedition/lcdui/Screen;->setUI(Lorg/microemu/device/ui/DisplayableUI;)V

    .line 45
    const/4 v0, -0x2

    iput v0, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    .line 46
    return-void
.end method

.method public constructor <init>(Ljava/lang/String;[Ljavax/microedition/lcdui/Item;)V
    .locals 4
    .parameter "title"
    .parameter "items"

    .prologue
    const/4 v3, 0x0

    .line 51
    invoke-direct {p0, p1}, Ljavax/microedition/lcdui/Form;-><init>(Ljava/lang/String;)V

    .line 54
    if-eqz p2, :cond_0

    .line 55
    array-length v1, p2

    new-array v1, v1, [Ljavax/microedition/lcdui/Item;

    iput-object v1, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    .line 56
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    array-length v2, p2

    invoke-static {p2, v3, v1, v3, v2}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 57
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    array-length v1, v1

    iput v1, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    .line 58
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    iget v1, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    if-ge v0, v1, :cond_0

    .line 59
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v1, v1, v0

    invoke-direct {p0, v1}, Ljavax/microedition/lcdui/Form;->verifyItem(Ljavax/microedition/lcdui/Item;)V

    .line 58
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 62
    .end local v0           #i:I
    :cond_0
    return-void
.end method

.method private getBottomVisibleIndex(I)I
    .locals 4
    .parameter "bottom"

    .prologue
    .line 497
    const/4 v0, 0x0

    .line 499
    .local v0, height:I
    const/4 v1, 0x0

    .local v1, i:I
    :goto_0
    iget v2, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    if-ge v1, v2, :cond_1

    .line 500
    iget-object v2, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v2, v2, v1

    invoke-virtual {v2}, Ljavax/microedition/lcdui/Item;->getHeight()I

    move-result v2

    add-int/2addr v0, v2

    .line 501
    if-le v0, p1, :cond_0

    move v2, v1

    .line 506
    :goto_1
    return v2

    .line 499
    :cond_0
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 506
    :cond_1
    iget v2, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    const/4 v3, 0x1

    sub-int/2addr v2, v3

    goto :goto_1
.end method

.method private getHeightToItem(I)I
    .locals 3
    .parameter "itemIndex"

    .prologue
    .line 512
    const/4 v0, 0x0

    .line 514
    .local v0, height:I
    const/4 v1, 0x0

    .local v1, i:I
    :goto_0
    if-ge v1, p1, :cond_0

    .line 515
    iget-object v2, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v2, v2, v1

    invoke-virtual {v2}, Ljavax/microedition/lcdui/Item;->getHeight()I

    move-result v2

    add-int/2addr v0, v2

    .line 514
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 518
    :cond_0
    return v0
.end method

.method private getTopVisibleIndex(I)I
    .locals 4
    .parameter "top"

    .prologue
    .line 482
    const/4 v0, 0x0

    .line 484
    .local v0, height:I
    const/4 v1, 0x0

    .local v1, i:I
    :goto_0
    iget v2, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    if-ge v1, v2, :cond_1

    .line 485
    iget-object v2, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v2, v2, v1

    invoke-virtual {v2}, Ljavax/microedition/lcdui/Item;->getHeight()I

    move-result v2

    add-int/2addr v0, v2

    .line 486
    if-lt v0, p1, :cond_0

    move v2, v1

    .line 491
    :goto_1
    return v2

    .line 484
    :cond_0
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 491
    :cond_1
    iget v2, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    const/4 v3, 0x1

    sub-int/2addr v2, v3

    goto :goto_1
.end method

.method private verifyItem(Ljavax/microedition/lcdui/Item;)V
    .locals 2
    .parameter "item"

    .prologue
    .line 532
    if-nez p1, :cond_0

    .line 533
    new-instance v0, Ljava/lang/NullPointerException;

    const-string v1, "item is null"

    invoke-direct {v0, v1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 535
    :cond_0
    invoke-virtual {p1}, Ljavax/microedition/lcdui/Item;->getOwner()Ljavax/microedition/lcdui/Screen;

    move-result-object v0

    if-eqz v0, :cond_1

    .line 536
    new-instance v0, Ljava/lang/IllegalStateException;

    const-string v1, "item is already owned"

    invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 539
    :cond_1
    invoke-virtual {p1, p0}, Ljavax/microedition/lcdui/Item;->setOwner(Ljavax/microedition/lcdui/Screen;)V

    .line 540
    return-void
.end method

.method private verifyItemNum(I)V
    .locals 2
    .parameter "itemNum"

    .prologue
    .line 551
    if-ltz p1, :cond_0

    iget v0, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    if-lt p1, v0, :cond_1

    .line 552
    :cond_0
    new-instance v0, Ljava/lang/IndexOutOfBoundsException;

    const-string v1, "item number is outside range of Form"

    invoke-direct {v0, v1}, Ljava/lang/IndexOutOfBoundsException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 554
    :cond_1
    return-void
.end method


# virtual methods
.method public append(Ljava/lang/String;)I
    .locals 3
    .parameter "str"

    .prologue
    const/4 v2, 0x0

    .line 99
    if-nez p1, :cond_0

    .line 100
    new-instance v0, Ljava/lang/NullPointerException;

    invoke-direct {v0}, Ljava/lang/NullPointerException;-><init>()V

    throw v0

    .line 103
    :cond_0
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->ui:Lorg/microemu/device/ui/DisplayableUI;

    invoke-virtual {v0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v0

    const-string v1, "org.microemu.android.device.ui.AndroidFormUI"

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_1

    .line 104
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->ui:Lorg/microemu/device/ui/DisplayableUI;

    check-cast v0, Lorg/microemu/device/ui/FormUI;

    new-instance v1, Ljavax/microedition/lcdui/StringItem;

    invoke-direct {v1, v2, p1}, Ljavax/microedition/lcdui/StringItem;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    invoke-interface {v0, v1}, Lorg/microemu/device/ui/FormUI;->append(Ljavax/microedition/lcdui/Item;)I

    .line 107
    :cond_1
    new-instance v0, Ljavax/microedition/lcdui/StringItem;

    invoke-direct {v0, v2, p1}, Ljavax/microedition/lcdui/StringItem;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    invoke-virtual {p0, v0}, Ljavax/microedition/lcdui/Form;->append(Ljavax/microedition/lcdui/Item;)I

    move-result v0

    return v0
.end method

.method public append(Ljavax/microedition/lcdui/Image;)I
    .locals 4
    .parameter "img"

    .prologue
    const/4 v3, 0x0

    const/4 v2, 0x0

    .line 89
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->ui:Lorg/microemu/device/ui/DisplayableUI;

    invoke-virtual {v0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v0

    const-string v1, "org.microemu.android.device.ui.AndroidFormUI"

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 90
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->ui:Lorg/microemu/device/ui/DisplayableUI;

    check-cast v0, Lorg/microemu/device/ui/FormUI;

    new-instance v1, Ljavax/microedition/lcdui/ImageItem;

    invoke-direct {v1, v2, p1, v3, v2}, Ljavax/microedition/lcdui/ImageItem;-><init>(Ljava/lang/String;Ljavax/microedition/lcdui/Image;ILjava/lang/String;)V

    invoke-interface {v0, v1}, Lorg/microemu/device/ui/FormUI;->append(Ljavax/microedition/lcdui/Item;)I

    .line 93
    :cond_0
    new-instance v0, Ljavax/microedition/lcdui/ImageItem;

    invoke-direct {v0, v2, p1, v3, v2}, Ljavax/microedition/lcdui/ImageItem;-><init>(Ljava/lang/String;Ljavax/microedition/lcdui/Image;ILjava/lang/String;)V

    invoke-virtual {p0, v0}, Ljavax/microedition/lcdui/Form;->append(Ljavax/microedition/lcdui/Item;)I

    move-result v0

    return v0
.end method

.method public append(Ljavax/microedition/lcdui/Item;)I
    .locals 4
    .parameter "item"

    .prologue
    const/4 v3, 0x0

    .line 67
    invoke-direct {p0, p1}, Ljavax/microedition/lcdui/Form;->verifyItem(Ljavax/microedition/lcdui/Item;)V

    .line 69
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->ui:Lorg/microemu/device/ui/DisplayableUI;

    invoke-virtual {v1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v1

    const-string v2, "org.microemu.android.device.ui.AndroidFormUI"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 70
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->ui:Lorg/microemu/device/ui/DisplayableUI;

    check-cast v1, Lorg/microemu/device/ui/FormUI;

    invoke-interface {v1, p1}, Lorg/microemu/device/ui/FormUI;->append(Ljavax/microedition/lcdui/Item;)I

    .line 73
    :cond_0
    iget v1, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    add-int/lit8 v1, v1, 0x1

    iget-object v2, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    array-length v2, v2

    if-lt v1, v2, :cond_1

    .line 74
    iget v1, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    add-int/lit8 v1, v1, 0x4

    new-array v0, v1, [Ljavax/microedition/lcdui/Item;

    .line 75
    .local v0, newitems:[Ljavax/microedition/lcdui/Item;
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    iget v2, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    invoke-static {v1, v3, v0, v3, v2}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 76
    iput-object v0, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    .line 78
    .end local v0           #newitems:[Ljavax/microedition/lcdui/Item;
    :cond_1
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    iget v2, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    aput-object p1, v1, v2

    .line 79
    iget v1, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    add-int/lit8 v1, v1, 0x1

    iput v1, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    .line 81
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Form;->repaint()V

    .line 83
    iget v1, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    const/4 v2, 0x1

    sub-int/2addr v1, v2

    return v1
.end method

.method public delete(I)V
    .locals 5
    .parameter "itemNum"

    .prologue
    const/4 v4, 0x1

    .line 113
    invoke-direct {p0, p1}, Ljavax/microedition/lcdui/Form;->verifyItemNum(I)V

    .line 115
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->ui:Lorg/microemu/device/ui/DisplayableUI;

    invoke-virtual {v0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v0

    const-string v1, "org.microemu.android.device.ui.AndroidFormUI"

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 116
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->ui:Lorg/microemu/device/ui/DisplayableUI;

    check-cast v0, Lorg/microemu/device/ui/FormUI;

    invoke-interface {v0, p1}, Lorg/microemu/device/ui/FormUI;->delete(I)V

    .line 119
    :cond_0
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v0, v0, p1

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Ljavax/microedition/lcdui/Item;->setOwner(Ljavax/microedition/lcdui/Screen;)V

    .line 120
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    add-int/lit8 v1, p1, 0x1

    iget-object v2, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    iget v3, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    sub-int/2addr v3, p1

    sub-int/2addr v3, v4

    invoke-static {v0, v1, v2, p1, v3}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 121
    iget v0, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    sub-int/2addr v0, v4

    iput v0, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    .line 123
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Form;->repaint()V

    .line 124
    return-void
.end method

.method public deleteAll()V
    .locals 3

    .prologue
    .line 129
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->ui:Lorg/microemu/device/ui/DisplayableUI;

    invoke-virtual {v1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v1

    const-string v2, "org.microemu.android.device.ui.AndroidFormUI"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 130
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->ui:Lorg/microemu/device/ui/DisplayableUI;

    check-cast v1, Lorg/microemu/device/ui/FormUI;

    invoke-interface {v1}, Lorg/microemu/device/ui/FormUI;->deleteAll()V

    .line 133
    :cond_0
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    iget v1, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    if-ge v0, v1, :cond_1

    .line 134
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v1, v1, v0

    const/4 v2, 0x0

    invoke-virtual {v1, v2}, Ljavax/microedition/lcdui/Item;->setOwner(Ljavax/microedition/lcdui/Screen;)V

    .line 133
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 136
    :cond_1
    const/4 v1, 0x0

    iput v1, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    .line 138
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Form;->repaint()V

    .line 139
    return-void
.end method

.method fireItemStateListener()V
    .locals 2

    .prologue
    .line 246
    iget v0, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    if-ltz v0, :cond_0

    iget v0, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    array-length v1, v1

    if-ge v0, v1, :cond_0

    .line 247
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    iget v1, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    aget-object v0, v0, v1

    invoke-virtual {p0, v0}, Ljavax/microedition/lcdui/Form;->fireItemStateListener(Ljavax/microedition/lcdui/Item;)V

    .line 248
    :cond_0
    return-void
.end method

.method fireItemStateListener(Ljavax/microedition/lcdui/Item;)V
    .locals 1
    .parameter "item"

    .prologue
    .line 239
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->itemStateListener:Ljavax/microedition/lcdui/ItemStateListener;

    if-eqz v0, :cond_0

    .line 240
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->itemStateListener:Ljavax/microedition/lcdui/ItemStateListener;

    invoke-interface {v0, p1}, Ljavax/microedition/lcdui/ItemStateListener;->itemStateChanged(Ljavax/microedition/lcdui/Item;)V

    .line 242
    :cond_0
    return-void
.end method

.method public get(I)Ljavax/microedition/lcdui/Item;
    .locals 1
    .parameter "itemNum"

    .prologue
    .line 144
    invoke-direct {p0, p1}, Ljavax/microedition/lcdui/Form;->verifyItemNum(I)V

    .line 146
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v0, v0, p1

    return-object v0
.end method

.method getCommands()Ljava/util/Vector;
    .locals 8

    .prologue
    .line 557
    invoke-super {p0}, Ljavax/microedition/lcdui/Screen;->getCommands()Ljava/util/Vector;

    move-result-object v1

    .line 558
    .local v1, formCommands:Ljava/util/Vector;
    iget v6, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    if-gez v6, :cond_0

    move-object v6, v1

    .line 579
    :goto_0
    return-object v6

    .line 561
    :cond_0
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    iget v7, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    aget-object v3, v6, v7

    .line 562
    .local v3, item:Ljavax/microedition/lcdui/Item;
    iget-object v5, v3, Ljavax/microedition/lcdui/Item;->commands:Ljava/util/Vector;

    .line 563
    .local v5, itemCommands:Ljava/util/Vector;
    invoke-virtual {v5}, Ljava/util/Vector;->isEmpty()Z

    move-result v6

    if-eqz v6, :cond_1

    move-object v6, v1

    .line 564
    goto :goto_0

    .line 570
    :cond_1
    new-instance v0, Ljava/util/Vector;

    invoke-direct {v0}, Ljava/util/Vector;-><init>()V

    .line 571
    .local v0, allCommands:Ljava/util/Vector;
    const/4 v2, 0x0

    .local v2, i:I
    :goto_1
    invoke-virtual {v1}, Ljava/util/Vector;->size()I

    move-result v6

    if-ge v2, v6, :cond_2

    .line 572
    invoke-virtual {v1, v2}, Ljava/util/Vector;->elementAt(I)Ljava/lang/Object;

    move-result-object v6

    invoke-virtual {v0, v6}, Ljava/util/Vector;->add(Ljava/lang/Object;)Z

    .line 571
    add-int/lit8 v2, v2, 0x1

    goto :goto_1

    .line 574
    :cond_2
    const/4 v2, 0x0

    :goto_2
    invoke-virtual {v5}, Ljava/util/Vector;->size()I

    move-result v6

    if-ge v2, v6, :cond_3

    .line 575
    invoke-virtual {v5, v2}, Ljava/util/Vector;->elementAt(I)Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Ljavax/microedition/lcdui/Command;

    .line 576
    .local v4, itemCommand:Ljavax/microedition/lcdui/Command;
    invoke-virtual {v4, v3}, Ljavax/microedition/lcdui/Command;->getItemCommand(Ljavax/microedition/lcdui/Item;)Ljavax/microedition/lcdui/Command;

    move-result-object v4

    .line 577
    invoke-virtual {v0, v4}, Ljava/util/Vector;->add(Ljava/lang/Object;)Z

    .line 574
    add-int/lit8 v2, v2, 0x1

    goto :goto_2

    .end local v4           #itemCommand:Ljavax/microedition/lcdui/Command;
    :cond_3
    move-object v6, v0

    .line 579
    goto :goto_0
.end method

.method public getHeight()I
    .locals 1

    .prologue
    .line 152
    invoke-super {p0}, Ljavax/microedition/lcdui/Screen;->getHeight()I

    move-result v0

    return v0
.end method

.method public getWidth()I
    .locals 1

    .prologue
    .line 158
    invoke-super {p0}, Ljavax/microedition/lcdui/Screen;->getWidth()I

    move-result v0

    return v0
.end method

.method hideNotify()V
    .locals 3

    .prologue
    .line 253
    invoke-super {p0}, Ljavax/microedition/lcdui/Screen;->hideNotify()V

    .line 256
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    iget v1, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    if-ge v0, v1, :cond_0

    .line 257
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v1, v1, v0

    invoke-virtual {v1}, Ljavax/microedition/lcdui/Item;->isFocusable()Z

    move-result v1

    if-eqz v1, :cond_1

    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v1, v1, v0

    invoke-virtual {v1}, Ljavax/microedition/lcdui/Item;->hasFocus()Z

    move-result v1

    if-eqz v1, :cond_1

    .line 258
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v1, v1, v0

    const/4 v2, 0x0

    invoke-virtual {v1, v2}, Ljavax/microedition/lcdui/Item;->setFocus(Z)V

    .line 259
    const/4 v1, -0x2

    iput v1, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    .line 263
    :cond_0
    return-void

    .line 256
    :cond_1
    add-int/lit8 v0, v0, 0x1

    goto :goto_0
.end method

.method public insert(ILjavax/microedition/lcdui/Item;)V
    .locals 5
    .parameter "itemNum"
    .parameter "item"

    .prologue
    const/4 v3, 0x0

    .line 164
    iget v1, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    if-eq p1, v1, :cond_0

    .line 165
    invoke-direct {p0, p1}, Ljavax/microedition/lcdui/Form;->verifyItemNum(I)V

    .line 167
    :cond_0
    invoke-direct {p0, p2}, Ljavax/microedition/lcdui/Form;->verifyItem(Ljavax/microedition/lcdui/Item;)V

    .line 169
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->ui:Lorg/microemu/device/ui/DisplayableUI;

    invoke-virtual {v1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v1

    const-string v2, "org.microemu.android.device.ui.AndroidFormUI"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    .line 170
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->ui:Lorg/microemu/device/ui/DisplayableUI;

    check-cast v1, Lorg/microemu/device/ui/FormUI;

    invoke-interface {v1, p1, p2}, Lorg/microemu/device/ui/FormUI;->insert(ILjavax/microedition/lcdui/Item;)V

    .line 173
    :cond_1
    iget v1, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    add-int/lit8 v1, v1, 0x1

    iget-object v2, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    array-length v2, v2

    if-ne v1, v2, :cond_2

    .line 174
    iget v1, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    add-int/lit8 v1, v1, 0x4

    new-array v0, v1, [Ljavax/microedition/lcdui/Item;

    .line 175
    .local v0, newitems:[Ljavax/microedition/lcdui/Item;
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    iget v2, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    invoke-static {v1, v3, v0, v3, v2}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 176
    iput-object v0, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    .line 178
    .end local v0           #newitems:[Ljavax/microedition/lcdui/Item;
    :cond_2
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    iget-object v2, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    add-int/lit8 v3, p1, 0x1

    iget v4, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    sub-int/2addr v4, p1

    invoke-static {v1, p1, v2, v3, v4}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 184
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aput-object p2, v1, p1

    .line 185
    iget-object v1, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v1, v1, p1

    invoke-virtual {v1, p0}, Ljavax/microedition/lcdui/Item;->setOwner(Ljavax/microedition/lcdui/Screen;)V

    .line 186
    iget v1, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    add-int/lit8 v1, v1, 0x1

    iput v1, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    .line 188
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Form;->repaint()V

    .line 189
    return-void
.end method

.method keyPressed(I)V
    .locals 2
    .parameter "keyCode"

    .prologue
    .line 268
    iget v0, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    const/4 v1, -0x1

    if-eq v0, v1, :cond_0

    .line 269
    invoke-static {p1}, Ljavax/microedition/lcdui/Display;->getGameAction(I)I

    move-result v0

    const/16 v1, 0x8

    if-ne v0, v1, :cond_1

    .line 270
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    iget v1, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    aget-object v0, v0, v1

    invoke-virtual {v0}, Ljavax/microedition/lcdui/Item;->select()Z

    .line 273
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Form;->fireItemStateListener()V

    .line 279
    :cond_0
    :goto_0
    invoke-super {p0, p1}, Ljavax/microedition/lcdui/Screen;->keyPressed(I)V

    .line 280
    return-void

    .line 275
    :cond_1
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    iget v1, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    aget-object v0, v0, v1

    invoke-virtual {v0, p1}, Ljavax/microedition/lcdui/Item;->keyPressed(I)V

    goto :goto_0
.end method

.method paintContent(Ljavax/microedition/lcdui/Graphics;)I
    .locals 5
    .parameter "g"

    .prologue
    const/4 v4, 0x0

    .line 225
    const/4 v0, 0x0

    .line 227
    .local v0, contentHeight:I
    const/4 v1, 0x0

    .local v1, i:I
    :goto_0
    iget v3, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    if-ge v1, v3, :cond_0

    .line 228
    iget-object v3, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v3, v3, v1

    invoke-virtual {v3, p1}, Ljavax/microedition/lcdui/Item;->paint(Ljavax/microedition/lcdui/Graphics;)I

    move-result v2

    .line 229
    .local v2, translateY:I
    invoke-virtual {p1, v4, v2}, Ljavax/microedition/lcdui/Graphics;->translate(II)V

    .line 230
    add-int/2addr v0, v2

    .line 227
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 232
    .end local v2           #translateY:I
    :cond_0
    neg-int v3, v0

    invoke-virtual {p1, v4, v3}, Ljavax/microedition/lcdui/Graphics;->translate(II)V

    .line 234
    return v0
.end method

.method public set(ILjavax/microedition/lcdui/Item;)V
    .locals 2
    .parameter "itemNum"
    .parameter "item"

    .prologue
    .line 194
    invoke-direct {p0, p1}, Ljavax/microedition/lcdui/Form;->verifyItemNum(I)V

    .line 195
    invoke-direct {p0, p2}, Ljavax/microedition/lcdui/Form;->verifyItem(Ljavax/microedition/lcdui/Item;)V

    .line 197
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->ui:Lorg/microemu/device/ui/DisplayableUI;

    invoke-virtual {v0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v0

    const-string v1, "org.microemu.android.device.ui.AndroidFormUI"

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 198
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->ui:Lorg/microemu/device/ui/DisplayableUI;

    check-cast v0, Lorg/microemu/device/ui/FormUI;

    invoke-interface {v0, p1, p2}, Lorg/microemu/device/ui/FormUI;->set(ILjavax/microedition/lcdui/Item;)V

    .line 202
    :cond_0
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v0, v0, p1

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Ljavax/microedition/lcdui/Item;->setOwner(Ljavax/microedition/lcdui/Screen;)V

    .line 204
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aput-object p2, v0, p1

    .line 205
    iget-object v0, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v0, v0, p1

    invoke-virtual {v0, p0}, Ljavax/microedition/lcdui/Item;->setOwner(Ljavax/microedition/lcdui/Screen;)V

    .line 207
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Form;->repaint()V

    .line 208
    return-void
.end method

.method public setItemStateListener(Ljavax/microedition/lcdui/ItemStateListener;)V
    .locals 0
    .parameter "iListener"

    .prologue
    .line 213
    iput-object p1, p0, Ljavax/microedition/lcdui/Form;->itemStateListener:Ljavax/microedition/lcdui/ItemStateListener;

    .line 214
    return-void
.end method

.method showNotify()V
    .locals 5

    .prologue
    .line 285
    invoke-super {p0}, Ljavax/microedition/lcdui/Screen;->showNotify()V

    .line 286
    iget v3, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    const/4 v4, -0x2

    if-ne v3, v4, :cond_0

    .line 287
    const/4 v3, -0x1

    iput v3, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    .line 289
    const/4 v2, 0x0

    .local v2, i:I
    :goto_0
    iget v3, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    if-ge v2, v3, :cond_0

    .line 290
    iget-object v3, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v3, v3, v2

    invoke-virtual {v3}, Ljavax/microedition/lcdui/Item;->isFocusable()Z

    move-result v3

    if-eqz v3, :cond_2

    .line 291
    iget-object v3, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v3, v3, v2

    const/4 v4, 0x1

    invoke-virtual {v3, v4}, Ljavax/microedition/lcdui/Item;->setFocus(Z)V

    .line 292
    iput v2, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    .line 297
    .end local v2           #i:I
    :cond_0
    iget v3, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    if-gez v3, :cond_3

    .line 306
    :cond_1
    :goto_1
    return-void

    .line 289
    .restart local v2       #i:I
    :cond_2
    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    .line 299
    .end local v2           #i:I
    :cond_3
    iget v3, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    invoke-direct {p0, v3}, Ljavax/microedition/lcdui/Form;->getHeightToItem(I)I

    move-result v1

    .line 300
    .local v1, heightToItem:I
    iget-object v3, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    iget v4, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    aget-object v3, v3, v4

    invoke-virtual {v3}, Ljavax/microedition/lcdui/Item;->getHeight()I

    move-result v3

    add-int v0, v1, v3

    .line 301
    .local v0, heightAfterItem:I
    iget v3, p0, Ljavax/microedition/lcdui/Form;->viewPortY:I

    if-le v3, v1, :cond_4

    .line 302
    iput v1, p0, Ljavax/microedition/lcdui/Form;->viewPortY:I

    goto :goto_1

    .line 303
    :cond_4
    iget v3, p0, Ljavax/microedition/lcdui/Form;->viewPortY:I

    iget v4, p0, Ljavax/microedition/lcdui/Form;->viewPortHeight:I

    add-int/2addr v3, v4

    if-ge v3, v0, :cond_1

    .line 304
    iget v3, p0, Ljavax/microedition/lcdui/Form;->viewPortHeight:I

    sub-int v3, v0, v3

    iput v3, p0, Ljavax/microedition/lcdui/Form;->viewPortY:I

    goto :goto_1
.end method

.method public size()I
    .locals 1

    .prologue
    .line 219
    iget v0, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    return v0
.end method

.method traverse(III)I
    .locals 10
    .parameter "gameKeyCode"
    .parameter "top"
    .parameter "bottom"

    .prologue
    .line 313
    iget v6, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    if-nez v6, :cond_0

    .line 314
    const/4 v6, 0x0

    .line 476
    :goto_0
    return v6

    .line 317
    :cond_0
    const/4 v6, 0x1

    if-ne p1, v6, :cond_8

    .line 318
    invoke-direct {p0, p2}, Ljavax/microedition/lcdui/Form;->getTopVisibleIndex(I)I

    move-result v4

    .line 319
    .local v4, topItemIndex:I
    iget v6, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    const/4 v7, -0x1

    if-ne v6, v7, :cond_2

    .line 320
    move v3, v4

    .line 321
    .local v3, testItemIndex:I
    invoke-direct {p0, v3}, Ljavax/microedition/lcdui/Form;->getHeightToItem(I)I

    move-result v1

    .line 322
    .local v1, height:I
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v6, v6, v3

    sub-int v7, p2, v1

    sub-int v8, p3, v1

    const/4 v9, 0x0

    invoke-virtual {v6, p1, v7, v8, v9}, Ljavax/microedition/lcdui/Item;->traverse(IIIZ)I

    move-result v5

    .line 338
    .local v5, traverse:I
    :goto_1
    const v6, 0x7fffffff

    if-eq v5, v6, :cond_3

    .line 339
    iget v6, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    const/4 v7, -0x1

    if-ne v6, v7, :cond_1

    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v6, v6, v3

    invoke-virtual {v6}, Ljavax/microedition/lcdui/Item;->isFocusable()Z

    move-result v6

    if-eqz v6, :cond_1

    .line 341
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v6, v6, v3

    const/4 v7, 0x1

    invoke-virtual {v6, v7}, Ljavax/microedition/lcdui/Item;->setFocus(Z)V

    .line 342
    iput v3, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    :cond_1
    move v6, v5

    .line 344
    goto :goto_0

    .line 329
    .end local v3           #testItemIndex:I
    .end local v1           #height:I
    .end local v5           #traverse:I
    :cond_2
    iget v3, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    .line 330
    .restart local v3       #testItemIndex:I
    invoke-direct {p0, v3}, Ljavax/microedition/lcdui/Form;->getHeightToItem(I)I

    move-result v1

    .line 331
    .restart local v1       #height:I
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v6, v6, v3

    sub-int v7, p2, v1

    sub-int v8, p3, v1

    const/4 v9, 0x1

    invoke-virtual {v6, p1, v7, v8, v9}, Ljavax/microedition/lcdui/Item;->traverse(IIIZ)I

    move-result v5

    .restart local v5       #traverse:I
    goto :goto_1

    .line 346
    :cond_3
    if-lez v3, :cond_8

    .line 351
    const/4 v6, 0x1

    sub-int v2, v3, v6

    .local v2, i:I
    :goto_2
    if-lt v2, v4, :cond_7

    .line 352
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v6, v6, v2

    invoke-virtual {v6}, Ljavax/microedition/lcdui/Item;->isFocusable()Z

    move-result v6

    if-eqz v6, :cond_6

    .line 353
    iget v6, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    const/4 v7, -0x1

    if-eq v6, v7, :cond_4

    .line 354
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    iget v7, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    aget-object v6, v6, v7

    const/4 v7, 0x0

    invoke-virtual {v6, v7}, Ljavax/microedition/lcdui/Item;->setFocus(Z)V

    .line 356
    :cond_4
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v6, v6, v2

    const/4 v7, 0x1

    invoke-virtual {v6, v7}, Ljavax/microedition/lcdui/Item;->setFocus(Z)V

    .line 357
    iput v2, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    .line 358
    invoke-direct {p0, v2}, Ljavax/microedition/lcdui/Form;->getHeightToItem(I)I

    move-result v1

    .line 359
    .restart local v1       #height:I
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v6, v6, v2

    sub-int v7, p2, v1

    sub-int v8, p3, v1

    const/4 v9, 0x0

    invoke-virtual {v6, p1, v7, v8, v9}, Ljavax/microedition/lcdui/Item;->traverse(IIIZ)I

    move-result v5

    .line 365
    .restart local v5       #traverse:I
    const v6, 0x7fffffff

    if-ne v5, v6, :cond_5

    .line 366
    const/4 v6, 0x0

    goto/16 :goto_0

    :cond_5
    move v6, v5

    .line 368
    goto/16 :goto_0

    .line 351
    :cond_6
    add-int/lit8 v2, v2, -0x1

    goto :goto_2

    .line 373
    :cond_7
    invoke-direct {p0, v4}, Ljavax/microedition/lcdui/Form;->getHeightToItem(I)I

    move-result v1

    .line 374
    .restart local v1       #height:I
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v6, v6, v4

    sub-int v7, p2, v1

    sub-int v8, p3, v1

    const/4 v9, 0x0

    invoke-virtual {v6, p1, v7, v8, v9}, Ljavax/microedition/lcdui/Item;->traverse(IIIZ)I

    move-result v5

    .line 380
    .restart local v5       #traverse:I
    const v6, 0x7fffffff

    if-ne v5, v6, :cond_a

    .line 396
    .end local v4           #topItemIndex:I
    .end local v3           #testItemIndex:I
    .end local v2           #i:I
    .end local v1           #height:I
    .end local v5           #traverse:I
    :cond_8
    const/4 v6, 0x6

    if-ne p1, v6, :cond_12

    .line 397
    invoke-direct {p0, p3}, Ljavax/microedition/lcdui/Form;->getBottomVisibleIndex(I)I

    move-result v0

    .line 398
    .local v0, bottomItemIndex:I
    iget v6, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    const/4 v7, -0x1

    if-ne v6, v7, :cond_c

    .line 399
    move v3, v0

    .line 400
    .restart local v3       #testItemIndex:I
    invoke-direct {p0, v3}, Ljavax/microedition/lcdui/Form;->getHeightToItem(I)I

    move-result v1

    .line 401
    .restart local v1       #height:I
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v6, v6, v3

    sub-int v7, p2, v1

    sub-int v8, p3, v1

    const/4 v9, 0x0

    invoke-virtual {v6, p1, v7, v8, v9}, Ljavax/microedition/lcdui/Item;->traverse(IIIZ)I

    move-result v5

    .line 417
    .restart local v5       #traverse:I
    :goto_3
    const v6, 0x7fffffff

    if-eq v5, v6, :cond_d

    .line 418
    iget v6, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    const/4 v7, -0x1

    if-ne v6, v7, :cond_9

    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v6, v6, v3

    invoke-virtual {v6}, Ljavax/microedition/lcdui/Item;->isFocusable()Z

    move-result v6

    if-eqz v6, :cond_9

    .line 420
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v6, v6, v3

    const/4 v7, 0x1

    invoke-virtual {v6, v7}, Ljavax/microedition/lcdui/Item;->setFocus(Z)V

    .line 421
    iput v3, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    :cond_9
    move v6, v5

    .line 423
    goto/16 :goto_0

    .line 385
    .end local v0           #bottomItemIndex:I
    .restart local v2       #i:I
    .restart local v4       #topItemIndex:I
    :cond_a
    add-int v6, p3, v5

    invoke-direct {p0, v6}, Ljavax/microedition/lcdui/Form;->getTopVisibleIndex(I)I

    move-result v0

    .line 386
    .restart local v0       #bottomItemIndex:I
    iget v6, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    const/4 v7, -0x1

    if-eq v6, v7, :cond_b

    iget v6, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    if-le v6, v0, :cond_b

    .line 388
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    iget v7, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    aget-object v6, v6, v7

    const/4 v7, 0x0

    invoke-virtual {v6, v7}, Ljavax/microedition/lcdui/Item;->setFocus(Z)V

    .line 389
    const/4 v6, -0x1

    iput v6, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    :cond_b
    move v6, v5

    .line 391
    goto/16 :goto_0

    .line 408
    .end local v3           #testItemIndex:I
    .end local v1           #height:I
    .end local v5           #traverse:I
    .end local v2           #i:I
    .end local v4           #topItemIndex:I
    :cond_c
    iget v3, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    .line 409
    .restart local v3       #testItemIndex:I
    invoke-direct {p0, v3}, Ljavax/microedition/lcdui/Form;->getHeightToItem(I)I

    move-result v1

    .line 410
    .restart local v1       #height:I
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v6, v6, v3

    sub-int v7, p2, v1

    sub-int v8, p3, v1

    const/4 v9, 0x1

    invoke-virtual {v6, p1, v7, v8, v9}, Ljavax/microedition/lcdui/Item;->traverse(IIIZ)I

    move-result v5

    .restart local v5       #traverse:I
    goto :goto_3

    .line 425
    :cond_d
    iget v6, p0, Ljavax/microedition/lcdui/Form;->numOfItems:I

    const/4 v7, 0x1

    sub-int/2addr v6, v7

    if-ge v3, v6, :cond_12

    .line 430
    add-int/lit8 v2, v3, 0x1

    .restart local v2       #i:I
    :goto_4
    if-gt v2, v0, :cond_11

    .line 431
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v6, v6, v2

    invoke-virtual {v6}, Ljavax/microedition/lcdui/Item;->isFocusable()Z

    move-result v6

    if-eqz v6, :cond_10

    .line 432
    iget v6, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    const/4 v7, -0x1

    if-eq v6, v7, :cond_e

    .line 433
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    iget v7, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    aget-object v6, v6, v7

    const/4 v7, 0x0

    invoke-virtual {v6, v7}, Ljavax/microedition/lcdui/Item;->setFocus(Z)V

    .line 435
    :cond_e
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v6, v6, v2

    const/4 v7, 0x1

    invoke-virtual {v6, v7}, Ljavax/microedition/lcdui/Item;->setFocus(Z)V

    .line 436
    iput v2, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    .line 437
    invoke-direct {p0, v2}, Ljavax/microedition/lcdui/Form;->getHeightToItem(I)I

    move-result v1

    .line 438
    .restart local v1       #height:I
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v6, v6, v2

    sub-int v7, p2, v1

    sub-int v8, p3, v1

    const/4 v9, 0x0

    invoke-virtual {v6, p1, v7, v8, v9}, Ljavax/microedition/lcdui/Item;->traverse(IIIZ)I

    move-result v5

    .line 444
    .restart local v5       #traverse:I
    const v6, 0x7fffffff

    if-ne v5, v6, :cond_f

    .line 445
    const/4 v6, 0x0

    goto/16 :goto_0

    :cond_f
    move v6, v5

    .line 447
    goto/16 :goto_0

    .line 430
    :cond_10
    add-int/lit8 v2, v2, 0x1

    goto :goto_4

    .line 452
    :cond_11
    invoke-direct {p0, v0}, Ljavax/microedition/lcdui/Form;->getHeightToItem(I)I

    move-result v1

    .line 453
    .restart local v1       #height:I
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    aget-object v6, v6, v0

    sub-int v7, p2, v1

    sub-int v8, p3, v1

    const/4 v9, 0x0

    invoke-virtual {v6, p1, v7, v8, v9}, Ljavax/microedition/lcdui/Item;->traverse(IIIZ)I

    move-result v5

    .line 459
    .restart local v5       #traverse:I
    const v6, 0x7fffffff

    if-ne v5, v6, :cond_13

    .line 476
    .end local v0           #bottomItemIndex:I
    .end local v3           #testItemIndex:I
    .end local v2           #i:I
    .end local v1           #height:I
    .end local v5           #traverse:I
    :cond_12
    const/4 v6, 0x0

    goto/16 :goto_0

    .line 464
    .restart local v0       #bottomItemIndex:I
    .restart local v1       #height:I
    .restart local v2       #i:I
    .restart local v3       #testItemIndex:I
    .restart local v5       #traverse:I
    :cond_13
    add-int v6, p2, v5

    invoke-direct {p0, v6}, Ljavax/microedition/lcdui/Form;->getTopVisibleIndex(I)I

    move-result v4

    .line 465
    .restart local v4       #topItemIndex:I
    iget v6, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    const/4 v7, -0x1

    if-eq v6, v7, :cond_14

    iget v6, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    if-ge v6, v4, :cond_14

    .line 467
    iget-object v6, p0, Ljavax/microedition/lcdui/Form;->items:[Ljavax/microedition/lcdui/Item;

    iget v7, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    aget-object v6, v6, v7

    const/4 v7, 0x0

    invoke-virtual {v6, v7}, Ljavax/microedition/lcdui/Item;->setFocus(Z)V

    .line 468
    const/4 v6, -0x1

    iput v6, p0, Ljavax/microedition/lcdui/Form;->focusItemIndex:I

    :cond_14
    move v6, v5

    .line 470
    goto/16 :goto_0
.end method
